package com.pan.basic;

import com.google.gson.JsonElement;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.pan.seed.Jone;
import org.apache.commons.lang.SerializationUtils;

import java.io.*;
import java.lang.reflect.Type;

public class SerializableTest {

    /**
     * 父类的值没办法进行序列化与反序列化
     * @param args
     * @throws IOException
     */
  public static void main(String[] args) throws IOException {
    //
      Jone jone = new Jone();
      jone.age="10";
      jone.name="jone";
      jone.setWife("大乔");
      byte[] serialize = SerializationUtils.serialize(jone);
      ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("object.txt"));
      oos.writeObject(serialize);
      Jone deserialize = (Jone)SerializationUtils.deserialize(serialize);
      System.out.println(deserialize.getWife());

  }
}
